package com.blb.thread;

public class Demo6DaemonThread {
    public static void main(String[] args) {
        Thread daemon = new Thread(()->{
           for(; ;){
               System.out.println("我一直守护着你，吾儿杜雄");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   e.printStackTrace();
               }
           }
        });

        daemon.setDaemon(true);
        daemon.start();
        for(int i=0;i<5;i++){
            new Thread(()->{
               for( int j=0;j<10;j++){
                   System.out.println(Thread.currentThread().getName()+"----->"+j);
                   try {
                       Thread.sleep(1000);
                   } catch (InterruptedException e) {
                       e.printStackTrace();
                   }
               }
            }).start();
        }
    }
}
